package com.qiaofang.constant;

import com.qiaofang.common.utils.StringUtil;

/**
 * api接口枚举类
 */
public enum ApiActionEnum {

    BASE_TYPE(1000, "基础接口"),
    PREMISES_AYS(2000, "楼盘同步"),
    PREMISES_AYS_PUTAWAY(2001, "楼盘上架"),
    PREMISES_AYS_TAKEAWAY(2002, "楼盘下架"),
    PREMISE_SALE_BEFORE(2003, "待售"),
    PREMISES_SALE_ON(2004, "在售"),
    PREMISES_SALE_OFF(2005, "售罄"),
    PREMISES_DELETE(2006, "楼盘删除"),
    PREMISES_DYNAMIC(3001, "楼盘动态"),
    REPORT_ADD(4000, "报备同步"),
    REPORT_AUDIT(4001, "报备审核"),
    REPORT_AUDIT_YES(4002, "未到访"),
    REPORT_AUDIT_VISITED(4003, "未到访"),
    REPORT_AUDIT_NO(4004, "报备无效"),
    REPORT_AUDIT_PAYDEPOSIT(4005, "认筹"),
    REPORT_AUDIT_SUBSCRIBE(4006, "认购"),
    REPORT_AUDIT_SIGN(4007, "签约"),
    REPORT_DEAL_NO(4008, "交易失败"),
    FOLLOW_AYS(5000, "报备跟进");

    private Integer no;
    private String des;

    /**
     * 私有构造函数
     *
     * @param no
     * @param des
     */
    ApiActionEnum(Integer no, String des) {
        this.no = no;
        this.des = des;
    }

    /**
     * @return Returns the no.
     */
    public Integer getNo() {
        return no;
    }

    /**
     * @return Returns the des.
     */
    public String getDes() {
        return des;
    }


    /**
     * 通过枚举<code>des</code>获得枚举
     *
     * @param des
     * @return
     */
    public static ApiActionEnum getByDescription(String des) {
        if (StringUtil.isBlank(des)) {
            return null;
        }
        for (ApiActionEnum menum : values()) {
            if (menum.getDes().equals(des)) {
                return menum;
            }
        }
        return null;
    }

    public static ApiActionEnum getByNo(Integer no) {
        if (no == null) {
            return null;
        }
        for (ApiActionEnum menum : values()) {
            if (menum.getNo().equals(no)) {
                return menum;
            }
        }
        return null;
    }

}
